package com.taxshare.purchaser.controller;

import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.purchaser.entity.*;
import com.taxshare.purchaser.service.*;
import com.taxshare.purchaser.view.dto.*;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YANG
 * @date 2021/4/12
 */
@RestController
@RequestMapping("/invoicePool")
@Api(tags = "发票池")
public class InvoicePoolController {

    @Autowired
    InvoicePoolService invoicePoolService;

    @Autowired
    BusTicketPoolService busTicketPoolService;

    @Autowired
    MachinTicketPoolService machinTicketPoolService;

    @Autowired
    PlaneTicketPoolService planeTicketPoolService;

    @Autowired
    QuotaTicketPoolService quotaTicketPoolService;

    @Autowired
    TaxiTicketPoolService taxiTicketPoolService;

    @Autowired
    TollTicketPoolService tollTicketPoolService;

    @Autowired
    TrainTicketPoolService trainTicketPoolService;

    @Autowired
    PlaneTicketCollectService planeTicketCollectService;

    @PostMapping("/query")
    @ApiOperation(value = "增值税发票池信息查询", notes = "发票池")
    public Response<InvoicePoolEntity> invoicePoolQuery(@RequestBody PageRequest<InvoicePoolDTO> query) {
        return invoicePoolService.invoicePoolQuery(query);
    }

    @PostMapping("/queryDetail")
    @ApiOperation(value = "增值税发票明细查询", notes = "发票池")
    public Response invoiceDetailQuery(@RequestBody PageRequest<InvoicePoolDTO> query) {
        return invoicePoolService.invoiceDetailQuery(query);
    }

    @PostMapping("/trainPoolQuery")
    @ApiOperation(value = "火车票发票池信息查询", notes = "发票池")
    public Response<TrainTicketPoolEntity> trainPoolQuery(@RequestBody PageRequest<TrainTicketDtO> query) {
        return trainTicketPoolService.trainPoolQuery(query);
    }

    @PostMapping("/busPoolQuery")
    @ApiOperation(value = "汽车票发票池信息查询", notes = "发票池")
    public Response<BusTicketPoolEntity> busPoolQuery(@RequestBody PageRequest<BusTicketDTO> query) {
        return busTicketPoolService.busPoolQuery(query);
    }

    @PostMapping("/machinPoolQuery")
    @ApiOperation(value = "机打发票发票池信息查询", notes = "发票池")
    public Response<MachinTicketPoolEntity> machinPoolQuery(@RequestBody PageRequest<MachinTicketDTO> query) {
        return machinTicketPoolService.machinPoolQuery(query);
    }

    @PostMapping("/planePoolQuery")
    @ApiOperation(value = "飞机客票行程单发票池信息查询", notes = "发票池")
    public Response<PlaneTicketPoolEntity> planePoolQuery(@RequestBody PageRequest<PlaneTicketDTO> query) {
        return planeTicketPoolService.planePoolQuery(query);
    }

    @PostMapping("/queryPlaneDetail")
    @ApiOperation(value = "飞机行程单航班信息查询", notes = "发票采集")
    public Response queryPlaneTicketDetail(@RequestBody PageRequest<PlaneTicketDTO> query) {
        return planeTicketCollectService.queryPlaneTicketDetail(query);
    }

    @PostMapping("/quotaPoolQuery")
    @ApiOperation(value = "定额发票发票池信息查询", notes = "发票池")
    public Response<QuotaTicketPoolEntity> quotaPoolQuery(@RequestBody PageRequest<QuotaTicketDTO> query) {
        return quotaTicketPoolService.quotaPoolQuery(query);
    }

    @PostMapping("/taxiPoolQuery")
    @ApiOperation(value = "出租车发票发票池信息查询", notes = "发票池")
    public Response<TaxiTicketPoolEntity> taxiPoolQuery(@RequestBody PageRequest<TaxiTicketDTO> query) {
        return taxiTicketPoolService.taxiPoolQuery(query);
    }

    @PostMapping("/tollPoolQuery")
    @ApiOperation(value = "过路费发票发票池信息查询", notes = "发票池")
    public Response<TollTicketPoolEntity> tollPoolQuery(@RequestBody PageRequest<TollTicketDTO> query) {
        return tollTicketPoolService.tollPoolQuery(query);
    }

    @PostMapping("/getAuthFlag")
    @ApiOperation(value = "获取发票是否可勾选标记", notes = "获取发票是否可勾选标记")
    public Response authApplyGetAuthFlag(@RequestBody InvoiceAuthFlagMainDTO beans){
        return invoicePoolService.authApplyGetAuthFlag(beans);
    }

}
